<!doctype html>
<!--[if gt IE 8]><!-->
<html class="no-js" lang="">
	<!--<![endif]-->
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>管理员课程信息</title>
		<meta name="description" content="Ela Admin - HTML5 Admin Template">
		<meta name="viewport" content="width=device-width, initial-scale=1">

		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.0/normalize.min.css">
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css">
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lykmapipo/themify-icons@0.1.2/css/themify-icons.css">
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixeden-stroke-7-icon@1.2.3/pe-icon-7-stroke/dist/pe-icon-7-stroke.min.css">
		<link rel="stylesheet" href="assets/css/cs-skin-elastic.css">
		<link rel="stylesheet" href="assets/css/lib/datatable/dataTables.bootstrap.min.css">
		<link rel="stylesheet" href="assets/css/style.css">

		<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/html5shiv/3.7.3/html5shiv.min.js"></script> -->
		<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/html5shiv/3.7.3/html5shiv.min.js"></script> -->
		<!--引入Vue-->
		<script src="assets/js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		
		<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0/axios.min.js"></script>
	</head>
	<body>
		<!-- Left Panel -->

		<aside id="left-panel" class="left-panel">
			<nav class="navbar navbar-expand-sm navbar-default">

				<div id="main-menu" class="main-menu collapse navbar-collapse">
					<ul class="nav navbar-nav">

						<li class="menu-title">菜单</li><!-- /.menu-title -->
						<li>
							<a href="adm-dataOfSetClass.html"> <i class="menu-icon fa fa-users"></i>增加班级 </a>
						</li>
						
						<li>
							<a href="adm-dataOfSetUser.html"> <i class="menu-icon fa fa-file-word-o"></i>增加用户 </a>
						</li>
						
						<li>
							<a href="adm-dataOfSetStudentClass.html"> <i class="menu-icon fa fa-users"></i>设置学生班级 </a>
						</li>
						<!--
					<li>
					    <a href="widgets.html"> <i class="menu-icon fa fa-envelope-open-o"></i>提交作业</a>
					</li>
					-->
						<li class="menu-title">退出</li><!-- /.menu-title -->
						<li>
							<a href="login.html"> <i class="menu-icon fa fa-user-o"></i>退出登录 </a>
						</li>
					</ul>
				</div><!-- /.navbar-collapse -->
			</nav>
		</aside><!-- /#left-panel -->

		<!-- Left Panel -->

		<!-- Right Panel -->

		<div id="right-panel" class="right-panel">

			<!-- Header-->
			<header id="header" class="header">
				<div class="top-left">
					<div class="navbar-header">
						<a class="navbar-brand" href="#"><i class="menu-icon fa fa-user fa-2x"></i></a>
					</div>
				</div>

			</header><!-- /header -->
			<!-- Header-->

			<div class="breadcrumbs">
				<div class="breadcrumbs-inner">
					<div class="row m-0">


					</div>
				</div>
			</div>

			<div class="content">
				<div class="animated fadeIn">
					<div class="row">

						<div class="col-md-12">
							<div class="card">
								<div class="card-header"><strong>注册/注销 用户信息</strong><small> </small></div>
								<div class="card-body card-block">
									<div class="form-group"><label for="name" class=" form-control-label">用户姓名</label>
										<input type="text" id="name" placeholder="输入用户姓名" class="form-control">
									</div>
									<div class="form-group"><label for="vat" class=" form-control-label">用户权限</label>
										<input type="text" id="level" placeholder="输入用户权限,不填则默认是学生用户" class="form-control">
									</div>
									<div class="form-group"><label for="username" class=" form-control-label">用户的帐号名</label>
										<input type="text" id="username" placeholder="输入学用户的帐号名" class="form-control"
									></div>
									<div class="form-group"><label for="password" class=" form-control-label">用户密码</label>
										<input type="text" id="password" placeholder="输入用户的密码" class="form-control"
									></div>
									
								</div>
							</div>
						</div>
							<!--添加按钮-->
						<div class="card-body" align="center">
							<input type="button" class="btn btn-success" onclick="ModifyAccount()" value="注册">
							
						</div>

					</div>
				</div><!-- .animated -->
			</div><!-- .content -->


			<!-- /#right-panel -->

			<!-- Right Panel -->

			<!-- Scripts -->
			<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min.js"></script>
			<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.4/dist/umd/popper.min.js"></script>
			<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/js/bootstrap.min.js"></script>
			<script src="https://cdn.jsdelivr.net/npm/jquery-match-height@0.7.2/dist/jquery.matchHeight.min.js"></script>
			<script src="assets/js/main.js"></script>


			
			<script src="assets/js/lib/data-table/dataTables.bootstrap.min.js"></script>
			<script src="assets/js/lib/data-table/dataTables.buttons.min.js"></script>
			<script src="assets/js/lib/data-table/buttons.bootstrap.min.js"></script>
			
			
			<script src="assets/js/lib/data-table/buttons.html5.min.js"></script>
			<script src="assets/js/lib/data-table/buttons.print.min.js"></script>
			<script src="assets/js/lib/data-table/buttons.colVis.min.js"></script>
			<script src="assets/js/init/datatables-init.js"></script>

			<script type="text/javascript">
				function ModifyAccount(){
					var name=document.getElementById('name').value;
					var username=document.getElementById('username').value;
					var password=document.getElementById('password').value;
					var level=document.getElementById('level').value;
					if(name==""||username==""||password=="")
					{
						alert("输入非法");
						//清空表单
						document.getElementById('name').value="";
						document.getElementById('username').value="";
						document.getElementById('userpass').value="";
						return;
					}
					var adminname=window.localStorage.getItem('AUsername');
					if(level==""){
						//是学生用户
						axios.get(
							'http://172.81.214.138:8000/student_re?opusername='+adminname+'&name='+name+'&username='+username+'&password='+password)
							//成功返回
							.then(response => {
								console.log(response);
								if(response.data.state==1){
									alert('注册学生用户成功');
								}
								else{
									alert('注册失败！');
								}
							})
							//失败返回
							.catch(error => {
								console.log(error);
							})
					}
					else{
						//老师用户
						axios.get(
							'http://172.81.214.138:8000/teacher_re?opusername='+adminname+'&name='+name+'&username='+username+'&password='+password+'&level='+level)
							//成功返回
							.then(response => {
								console.log(response);
								if(response.data.state==1){
									alert('注册老师成功');
								}
								else{
									alert('注册失败！');
								}
							})
							//失败返回
							.catch(error => {
								console.log(error);
							})
					}
				}
			</script>


	</body>
</html>
